define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {

    var Controller = {
        index: function () {
            // 初始化表格参数配置
            Table.api.init({
                extend: {
                    index_url: 'user/Firstdeposit/index',
                    // del_url: 'user/walletrecord/del',
                    table: 'wallet_record',
                }
            });

            var table = $("#table");

            // 初始化表格
            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                pk: 'id',
                sortName: 'id',
                columns: [
                    [
                        {field: 'record_sn', title: '交易流水号'},
                        {field: 'user.username', title: '账号'},
                        {field: 'user.group_id', title: '角色',searchList: {"1":'系统账号',"2":'玩家',"3":'代理'}, formatter: Table.api.formatter.status},
                        {field: 'remark', title: '交易备注'},
                        //{field: 'type_name', title: '交易类型'},
                        {field: 'money', title: '首次存款', operate:'BETWEEN'},
                        {field: 'pay_status', title: '状态', searchList: {"0":__('Pay_status 0'),"1":'成功',"-1":'失败'}, formatter: Table.api.formatter.status},
                        {field: 'pay_time', title: '交易时间', operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
                        //{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
                    ]
                ]
            });

            // 为表格绑定事件
            Table.api.bindevent(table);
        },
        add: function () {
            Controller.api.bindevent();
        },
        edit: function () {
            Controller.api.bindevent();
        },
        api: {
            bindevent: function () {
                Form.api.bindevent($("form[role=form]"));
            }
        }
    };
    return Controller;
});